package 笔试题.pdd;

import java.util.HashSet;
import java.util.Scanner;

public class t4 {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] set = new int[M];
        for (int i = 0; i < set.length; i++) {
            set[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 1; i <= N; i++) {
            a:
            for (int j = 0; j < M; j++) {
                if (i % set[j] == 0) {
                    count++;
                    break a;
                }
            }
        }
        System.out.println(count);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        int count = 0;
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < m; i++) {
            int temp = a[i];
            int tmp = a[i];
            int f = 1;
            while (tmp <= n) {
                if (!set.contains(tmp)) {
                    set.add(tmp);
                    f++;
                    tmp = temp * f;
                    count++;
                } else {
                    f++;
                    tmp = temp * f;
                }
            }
        }
        System.out.println(count);
    }

    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] set = new int[M];
        int count = 0;
        for (int i = 0; i < set.length; i++) {
            set[i] = sc.nextInt();
            count += (N / set[i]);
        }
        for (int i = 0; i < set.length; i++) {
            for (int j = i + 1; j < set.length; j++) {
                if ((set[i] * set[j]) <= N) {
                    count--;
                }
            }
        }
        System.out.println(count);
    }
}
